// in caps because it's a global variable
// 'adon/' for local version
var BASEPATH = 'adon/';

// Create CM
// Check if the user is logged
var CC = new CC();
CC.testLogin();


// Create global variable to store classes
var MC, IC, UC;

adjust_height();
/*$(window).resize(function() {
	adjust_height(); // adjust the height of the map
});//*/

/*
 * JS page initialization
 */

// page with list of items
function initPageItems()
{
	MC = new MC();
	
	console.log('page : items');
}

// page to display one item
function initPageItem(id)
{
	console.log('item');
	
	//Create MMC
	MMC = new MMC();

	// Create UserManager
	UMC = new UMC();	
	
	// Create ObjectManager
	IMC = new IMC();
	
	// load header
	
	// PREVIOUS TO PUT IN AN "action" bar up
	//$('#contentHeader').html('<a href="/'+BASEPATH+'">< Previous</a>');
	//$('#contentHeader').html('<img src="/'+BASEPATH+'assets/img/ajax-loader.gif">');
	//$('#contentHeader').load('/'+BASEPATH+'pages/view_part/contentHeader');

	// set the page to default
	IMC.set_page('item');
	
	// get the item
	IMC.init_display('item', id, null);
	
	// refresh objects list
	// onMoveEnd works
	
	// get the item
	//ObjectManager.refresh('item', id, null);
	
	// center map on the item

}

// page with list of users
function initPageUsers()
{	
	
	//Create MMC
	MMC = new MMC();
	
	// Create ObjectManager
	IMC = new IMC();
	
	// set the page to default
	IMC.set_page('users');
}

//page with one user to display
function initPageUser(uid)
{

	//Create MMC
	MMC = new MMC();
	
	// Create UserManager
	UMC = new UMC();
	
	// Create ObjectManager
	IMC = new IMC();
	
	// set the page to default
	IMC.set_page('user');
	IMC.set_uid(uid);
	MMC.set_distanceFrom('here');
	
	// COPIER LE CODE ITEMS DS USER
	//UMC.init_display(uid);
	
	
}